package com.leyou.item.mapper;

import com.leyou.item.pojo.Category;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;

/**
 * 商品分类mapper
 */
public interface CategoryMapper extends Mapper<Category> {

    @Select("SELECT * FROM TB_CATEGORY T\n" +
            " WHERE EXISTS (SELECT * FROM TB_CATEGORY_BRAND T2\n" +
            "         WHERE T2.CATEGORY_ID = T.ID\n" +
            "           AND T2.BRAND_ID = #{bid})")
    public List<Category> queryByBrandId(Long bid);
}
